package com.example.aqs;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author mwh
 * @Description:
 * @date 2022/1/20 10:49
 */
public class CasTest {
    private static int i = 0 ;
     private static CountDownLatch countDownLatch = new CountDownLatch(10);
     private static ExecutorService executorService = Executors.newFixedThreadPool(10);
    public static void main(String[] args) throws InterruptedException {

        for(int j=0;j<10;j++){
            executorService.submit(new Thread(()->{

                for(int m=0;m<10;m++){
                    i++;
                }
                countDownLatch.countDown();
                System.out.println(Thread.currentThread().getName()+"==="+i);
            }));
            countDownLatch.await();
        }

        System.out.println("===zogn:"+i);

    }
}
